# to build it, you should first assign to PATH
MOD_NAME = cmdline_test
CONFIG_MODULE_SIG=n
ifneq ($(KERNELRELEASE),)

obj-m := $(MOD_NAME).o
$(MOD_NAME)-objs := cmdline-mod.o
#si3050-objs := SI3050.o hd_if.o
else
# for O1 8176
#KERNEL_DIR := /home/tj/code/O1_8176/alps2/out/target/product/tb8176p1_64_bsp/obj/KERNEL_OBJ
# for P0 8163
#KERNEL_DIR := /home/tj/code/P08163_git/alps/out/target/product/tb8163p3_64_bsp/obj/KERNEL_OBJ
# for rk3308 linux
#KERNEL_DIR := /home/tj/code/RK3308_git/alps2/kernel
# for rk3399
#KERNEL_DIR := /home/tj/code/O13399_git/alps3/kernel
# for 3288 8.1
#KERNEL_DIR := /home/tj/code/RK3288/alps/kernel
#for rk3326 9.0
#KERNEL_DIR := /home/tj/code/P03326_git/alps/kernel
# for rk312x 4.4
#KERNEL_DIR := /home/tj/code/rk312x/alps2/kernel
# export PATH=/home/tj/code/O13399_git/alps3/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin:$PATH
# for linux build
KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
KSOURCE_DIR = /usr/src/linux-headers-4.4.0-87-generic
all:
#	make -C $(KERNEL_DIR) M=$(PWD) modules CROSS_COMPILE=aarch64-linux-android- ARCH=arm64
#	make -C $(KERNEL_DIR) M=$(PWD) modules CROSS_COMPILE=arm-eabi- ARCH=arm
	# make -C $(KERNEL_DIR) M=$(PWD) modules CROSS_COMPILE=arm-linux-androideabi- ARCH=arm
	make -C $(KERNEL_DIR) M=$(PWD) modules


install:
	sudo insmod $(MOD_NAME).ko
	#sudo chmod 0666 /dev/$(MOD_NAME)

uninstall:
	sudo rmmod $(MOD_NAME)

clean:
	rm -f *.o *.ko *.order Module.symvers *.mod.c
endif
